/**
 * 
 */
package me.dbest.javase.prodNcons;

/**
 * @author nishant
 * 
 */
public class Producer implements Runnable {


    Q q;

    Producer(Q q) {
	this.q = q;
	new Thread(this, "Producer").start();
    }

    public void run() {
	int i = 0;
	while (true) {
	    q.put(i++);
	    if(i==100){
		try {
		    Thread.currentThread().sleep(30000);
		} catch (InterruptedException e) {
		    e.printStackTrace();
		}
	    }
	}
    }

    /**
     * @param args
     */
    public static void main(String[] args) {
	// TODO Auto-generated method stub

    }

}
